From 5901586428bc4301b69519ec29a2bafbcfbaf785 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Thu, 16 Dec 2021 15:00:12 -0700 Subject: [PATCH] retire is_fatal for better static analysis (#797) * join is_fatal lines in prep for transformation. 1,$g/is_fatal.*[^;]$/j * replace is_fatal with if() fatal(). this allows better static analysis. sed -i '1,$s/^\( *\)is_fatal *( *\(.*\), *MYNAME\([^;]*\);$/\1if (\2) {\n\1 fatal(MYNAME\3;\n\1}/' $file sed -i '1,$s/^\( *\)is_fatal *( *\(.*\), *"\([^;]*\);$/\1if (\2) {\n\1 fatal("\3;\n\1}/' $file * manual delete extra parenthesis. --- defs.h | 1 - exif.cc | 29 ++++++++++++++++++++++------- f90g_track.cc | 4 +++- garmin_fit.cc | 5 +++-- garmin_gpi.cc | 19 ++++++++++++------- garmin_txt.cc | 20 +++++++++++++++----- gbfile.cc | 29 ++++++++++++++++++----------- gdb.cc | 31 +++++++++++++++++++++---------- globalsat_sport.cc | 8 ++++++-- magproto.cc | 8 ++++++-- mapbar_track.cc | 8 ++++++-- mmo.cc | 4 +++- raymarine.cc | 5 +++-- subrip.cc | 8 ++++++-- unicsv.cc | 4 +++- util.cc | 25 ++++++------------------- vecs.cc | 10 ++++++---- xcsv.cc | 8 ++++++-- 18 files changed, 145 insertions(+), 81 deletions(-) diff --git a/defs.h b/defs.h index b57b1ed95..05bfa2305 100644 --- a/defs.h +++ b/defs.h @@ -1058,7 +1058,6 @@ extern const QVector style_list; [[noreturn]] void fatal(QDebug& msginstance); [[noreturn]] void fatal(const char*, ...) PRINTFLIKE(1, 2); -void is_fatal(int condition, const char*, ...) PRINTFLIKE(2, 3); void warning(const char*, ...) PRINTFLIKE(1, 2); void printposn(double c, int is_lat); diff --git a/exif.cc b/exif.cc index a2e217efb..612b06724 100644 --- a/exif.cc +++ b/exif.cc @@ -684,8 +684,12 @@ exif_examine_app(ExifApp* app) gbfrewind(ftmp); uint32_t ident = gbfgetuint32(ftmp); - is_fatal(ident != 0x66697845, MYNAME ": Invalid EXIF header magic."); - is_fatal(gbfgetint16(ftmp) != 0, MYNAME ": Error in EXIF header."); + if (ident != 0x66697845) { + fatal(MYNAME ": Invalid EXIF header magic."); + } + if (gbfgetint16(ftmp) != 0) { + fatal(MYNAME ": Error in EXIF header."); + } uint16_t endianness = gbfgetint16(ftmp); if (global_opts.debug_level >= 3) { @@ -1488,10 +1492,15 @@ static void exif_read() { uint16_t soi = gbfgetuint16(fin_); - is_fatal(soi != 0xFFD8, MYNAME ": Unknown image file."); /* only jpeg for now */ + /* only jpeg for now */ + if (soi != 0xFFD8) { + fatal(MYNAME ": Unknown image file."); + } exif_app_ = exif_load_apps(); - is_fatal(exif_app_ == nullptr, MYNAME ": No EXIF header in source file \"%s\".", fin_->name); + if (exif_app_ == nullptr) { + fatal(MYNAME ": No EXIF header in source file \"%s\".", fin_->name); + } exif_examine_app(exif_app_); Waypoint* wpt = exif_waypt_from_exif_app(exif_app_); @@ -1509,12 +1518,18 @@ exif_wr_init(const QString& fname) exif_apps = new QList; fin_ = gbfopen_be(fname, "rb", MYNAME); - is_fatal(fin_->is_pipe, MYNAME ": Sorry, this format cannot be used with pipes!"); + if (fin_->is_pipe) { + fatal(MYNAME ": Sorry, this format cannot be used with pipes!"); + } uint16_t soi = gbfgetuint16(fin_); - is_fatal(soi != 0xFFD8, MYNAME ": Unknown image file."); + if (soi != 0xFFD8) { + fatal(MYNAME ": Unknown image file."); + } exif_app_ = exif_load_apps(); - is_fatal(exif_app_ == nullptr, MYNAME ": No EXIF header found in source file \"%s\".", fin_->name); + if (exif_app_ == nullptr) { + fatal(MYNAME ": No EXIF header found in source file \"%s\".", fin_->name); + } exif_examine_app(exif_app_); gbfclose(fin_); diff --git a/f90g_track.cc b/f90g_track.cc index 77e50a5e7..f9eee80e6 100644 --- a/f90g_track.cc +++ b/f90g_track.cc @@ -90,7 +90,9 @@ f90g_track_read() char northSouth, eastWest, velocityMark, ttRec[TTRECORDSIZE], tempBuf[20]; int year, mon, mday, hour, min, sec, latitudeDeg, latitudeMin, longitudeDeg, longitudeMin, velocity; - is_fatal((track == nullptr), MYNAME "Track setup error"); + if (track == nullptr) { + fatal(MYNAME "Track setup error"); + } for (;;) { if ((gbfread((void*)ttRec, 1, 2, fin) != 2) || (memcmp(ttRec,"TT",2))) { diff --git a/garmin_fit.cc b/garmin_fit.cc index c75307530..7347b2119 100644 --- a/garmin_fit.cc +++ b/garmin_fit.cc @@ -107,8 +107,9 @@ GarminFitFormat::fit_parse_header() // data length fit_data.len = gbfgetuint32(fin); // File signature - is_fatal(gbfread(sig, 4, 1, fin) != 1, - MYNAME ": Unexpected end of file\n"); + if (gbfread(sig, 4, 1, fin) != 1) { + fatal(MYNAME ": Unexpected end of file\n"); + } if (sig[0] != '.' || sig[1] != 'F' || sig[2] != 'I' || sig[3] != 'T') { fatal(MYNAME ": .FIT signature missing\n"); } diff --git a/garmin_gpi.cc b/garmin_gpi.cc index fc9d21262..868f4a5e3 100644 --- a/garmin_gpi.cc +++ b/garmin_gpi.cc @@ -297,14 +297,16 @@ gpi_read_string(const char* field) char first = gbfgetc(fin); if (first == 0) { - is_fatal((gbfgetc(fin) != 0), - MYNAME ": Error reading field '%s'!", field); + if (gbfgetc(fin) != 0) { + fatal(MYNAME ": Error reading field '%s'!", field); + } lc_string res1 = gpi_read_lc_string(); if ((res1.strlen + 4) < l0) { // dual language? lc_string res2 = gpi_read_lc_string(); - is_fatal((res1.strlen + 4 + res2.strlen + 4 != l0), - MYNAME ": Error out of sync (wrong size %d/%d/%d) on field '%s'!", l0, res1.strlen, res2.strlen, field); + if (res1.strlen + 4 + res2.strlen + 4 != l0) { + fatal(MYNAME ": Error out of sync (wrong size %d/%d/%d) on field '%s'!", l0, res1.strlen, res2.strlen, field); + } if (opt_lang && (opt_lang == res1.lc)) { string = res1.str; } else if (opt_lang && (opt_lang == res2.lc)) { @@ -313,8 +315,9 @@ gpi_read_string(const char* field) fatal(MYNAME ": Must select language code, %s and %s found.\n", res1.lc.constData(), res2.lc.constData()); } } else { // normal case, single language - is_fatal((res1.strlen + 4 != l0), - MYNAME ": Error out of sync (wrong size %d/%d) on field '%s'!", l0, res1.strlen, field); + if (res1.strlen + 4 != l0) { + fatal(MYNAME ": Error out of sync (wrong size %d/%d) on field '%s'!", l0, res1.strlen, field); + } string = res1.str; } } else { @@ -1269,7 +1272,9 @@ load_bitmap_from_file(const char* fname, unsigned char** data, int* data_sz) unsigned char* ptr; gbfile* f = gbfopen_le(fname, "rb", MYNAME); - is_fatal(gbfgetint16(f) != 0x4d42, MYNAME ": No BMP image."); + if (gbfgetint16(f) != 0x4d42) { + fatal(MYNAME ": No BMP image."); + } /* read a standard bmp file header */ src_h.size = gbfgetint32(f); diff --git a/garmin_txt.cc b/garmin_txt.cc index d6a71236a..38a4e72f6 100644 --- a/garmin_txt.cc +++ b/garmin_txt.cc @@ -760,7 +760,9 @@ garmin_txt_wr_init(const QString& fname) init_date_and_time_format(); if (opt_precision) { precision = atoi(opt_precision); - is_fatal(precision < 0, MYNAME ": Invalid precision (%s)!", opt_precision); + if (precision < 0) { + fatal(MYNAME ": Invalid precision (%s)!", opt_precision); + } } datum_str = get_option_val(opt_datum, nullptr); @@ -900,7 +902,9 @@ parse_date_and_time(const QString& str, time_t* value) char* cerr = strptime(cin, date_time_format, &tm); if (cerr == nullptr) { cerr = strptime(cin, "%m/%d/%Y %I:%M:%S %p", &tm); - is_fatal(cerr == nullptr, MYNAME ": Invalid date or/and time \"%s\" at line %d!", qPrintable(tstr), current_line); + if (cerr == nullptr) { + fatal(MYNAME ": Invalid date or/and time \"%s\" at line %d!", qPrintable(tstr), current_line); + } } // printf(MYNAME "_parse_date_and_time: %02d.%02d.%04d, %02d:%02d:%02d\n", @@ -996,7 +1000,9 @@ parse_display(const QString& str, int* val) static void bind_fields(const header_type ht) { - is_fatal((grid_index < 0) || (datum_index < 0), MYNAME ": Incomplete or invalid file header!"); + if ((grid_index < 0) || (datum_index < 0)) { + fatal(MYNAME ": Incomplete or invalid file header!"); + } if (header_ct[unknown_header] <= 0) { return; @@ -1237,9 +1243,13 @@ parse_route_waypoint(const QStringList& lineparts) int field_no = header_fields[rtept_header][column]; switch (field_no) { case 1: - is_fatal((str.isEmpty()), MYNAME ": Route waypoint without name at line %d!\n", current_line); + if (str.isEmpty()) { + fatal(MYNAME ": Route waypoint without name at line %d!\n", current_line); + } wpt = find_waypt_by_name(str); - is_fatal((wpt == nullptr), MYNAME ": Route waypoint \"%s\" not in waypoint list (line %d)!\n", qPrintable(str), current_line); + if (wpt == nullptr) { + fatal(MYNAME ": Route waypoint \"%s\" not in waypoint list (line %d)!\n", qPrintable(str), current_line); + } wpt = new Waypoint(*wpt); break; } diff --git a/gbfile.cc b/gbfile.cc index b9f8c906c..a2c86b28c 100644 --- a/gbfile.cc +++ b/gbfile.cc @@ -218,7 +218,9 @@ gzapi_eof(gbfile* self) /* we are at the end of the file */ if (global_opts.debug_level > 0) { /* now gzeof() should return 1 */ - is_fatal(!gzeof(self->handle.gz), "zlib gzeof error!\n"); + if (!gzeof(self->handle.gz)) { + fatal("zlib gzeof error!\n"); + } } res = 1; } @@ -917,8 +919,9 @@ gbfgetint32(gbfile* file) { char buf[4]; - is_fatal((gbfread(&buf, 1, sizeof(buf), file) != sizeof(buf)), - "%s: Unexpected end of file (%s)!\n", file->module, file->name); + if (gbfread(&buf, 1, sizeof(buf), file) != sizeof(buf)) { + fatal("%s: Unexpected end of file (%s)!\n", file->module, file->name); + } if (file->big_endian) { return be_read32(buf); @@ -936,8 +939,9 @@ gbfgetint16(gbfile* file) { char buf[2]; - is_fatal((gbfread(&buf, 1, sizeof(buf), file) != sizeof(buf)), - "%s: Unexpected end of file (%s)!\n", file->module, file->name); + if (gbfread(&buf, 1, sizeof(buf), file) != sizeof(buf)) { + fatal("%s: Unexpected end of file (%s)!\n", file->module, file->name); + } if (file->big_endian) { return be_read16(buf); @@ -955,8 +959,9 @@ gbfgetdbl(gbfile* file) { char buf[8]; - is_fatal((gbfread(&buf, 1, sizeof(buf), file) != sizeof(buf)), - "%s: Unexpected end of file (%s)!\n", file->module, file->name); + if (gbfread(&buf, 1, sizeof(buf), file) != sizeof(buf)) { + fatal("%s: Unexpected end of file (%s)!\n", file->module, file->name); + } return endian_read_double(buf, ! file->big_endian); } @@ -970,8 +975,9 @@ gbfgetflt(gbfile* file) { char buf[4]; - is_fatal((gbfread(&buf, 1, sizeof(buf), file) != sizeof(buf)), - "%s: Unexpected end of file (%s)!\n", file->module, file->name); + if (gbfread(&buf, 1, sizeof(buf), file) != sizeof(buf)) { + fatal("%s: Unexpected end of file (%s)!\n", file->module, file->name); + } return endian_read_float(buf, ! file->big_endian); } @@ -1046,8 +1052,9 @@ gbfgetpstr(gbfile* file) } QByteArray ba; ba.resize(len); - is_fatal((gbfread(ba.data(), 1, len, file) != (gbsize_t) len), - "%s: Unexpected end of file (%s)!\n", file->module, file->name); + if (gbfread(ba.data(), 1, len, file) != (gbsize_t) len) { + fatal("%s: Unexpected end of file (%s)!\n", file->module, file->name); + } return QString(ba); } diff --git a/gdb.cc b/gdb.cc index 607505802..1c801d3bb 100644 --- a/gdb.cc +++ b/gdb.cc @@ -419,24 +419,30 @@ read_file_header() The following message "local buffer overflow detected..." could be misinterpreted. */ - is_fatal(strcmp(buf, "MsRcf") != 0, MYNAME ": Invalid file \"%s\"!", fin->name); + if (strcmp(buf, "MsRcf") != 0) { + fatal(MYNAME ": Invalid file \"%s\"!", fin->name); + } int reclen = FREAD_i32; Q_UNUSED(reclen); QByteArray drec = FREAD_STR(); - is_fatal(drec.at(0) != 'D', MYNAME ": Invalid file \"%s\"!", fin->name); + if (drec.at(0) != 'D') { + fatal(MYNAME ": Invalid file \"%s\"!", fin->name); + } gdb_ver = drec.at(1) - 'k' + 1; - is_fatal((gdb_ver < GDB_VER_MIN) || (gdb_ver > GDB_VER_MAX), - MYNAME ": Unknown or/and unsupported GDB version (%d.0)!", gdb_ver); + if ((gdb_ver < GDB_VER_MIN) || (gdb_ver > GDB_VER_MAX)) { + fatal(MYNAME ": Unknown or/and unsupported GDB version (%d.0)!", gdb_ver); + } if (global_opts.verbose_status > 0) { printf(MYNAME ": Reading Garmin GPS Database version %d.0\n", gdb_ver); } reclen = FREAD_i32; - is_fatal((reclen + 1 > int(sizeof(buf))), - MYNAME ": Invalid record length\n"); + if (reclen + 1 > int(sizeof(buf))) { + fatal(MYNAME ": Invalid record length\n"); + } (void) FREAD(buf, reclen + 1); if (global_opts.verbose_status > 0) { const char* name = buf+2; @@ -449,7 +455,9 @@ read_file_header() } QByteArray applicationField = FREAD_STR(); - is_fatal(!((applicationField == "MapSource") || (applicationField == "BaseCamp")), MYNAME ": Not a recognized signature in header"); + if (!((applicationField == "MapSource") || (applicationField == "BaseCamp"))) { + fatal(MYNAME ": Not a recognized signature in header"); + } } /*-----------------------------------------------------------------------------*/ @@ -1084,7 +1092,9 @@ read_data() } int delta = len - gbftell(ftmp); - is_fatal(delta > 1000000, "Internal consistency error. Delta too big"); + if (delta > 1000000) { + fatal("Internal consistency error. Delta too big"); + } // Avoid finite loop on bogus beta files from '06. // THe 100000 is totally pulled from my hat. @@ -1745,8 +1755,9 @@ gdb_wr_init(const QString& fname) gdb_ver = (gdb_opt_ver && *gdb_opt_ver) ? atoi(gdb_opt_ver) : 0; if (gdb_category) { - is_fatal((gdb_category < 1) || (gdb_category > 16), - MYNAME ": cat must be between 1 and 16!"); + if ((gdb_category < 1) || (gdb_category > 16)) { + fatal(MYNAME ": cat must be between 1 and 16!"); + } gdb_category = 1 << (gdb_category - 1); } diff --git a/globalsat_sport.cc b/globalsat_sport.cc index f1a90318f..a5b7f9e73 100644 --- a/globalsat_sport.cc +++ b/globalsat_sport.cc @@ -121,7 +121,9 @@ GlobalsatSportFormat::recv_byte() result=serial_recv_byte(); } else { result = gbfgetc(in_file); - is_fatal((result < 0), MYNAME ": read error"); + if (result < 0) { + fatal(MYNAME ": read error"); + } } // Check if byte should be dumped also into a file if (dumpfile) { @@ -280,7 +282,9 @@ GlobalsatSportFormat::rd_init(const QString& fname) } else { // read from dump-file instead of serial in_file = gbfopen(fname, "rb", MYNAME); - is_fatal(!in_file, "Could not open dumpfile for input: %s", qPrintable(fname)); + if (!in_file) { + fatal("Could not open dumpfile for input: %s", qPrintable(fname)); + } } if (opt_timezone) { diff --git a/magproto.cc b/magproto.cc index ca9fb5adb..920d8be78 100644 --- a/magproto.cc +++ b/magproto.cc @@ -1049,10 +1049,14 @@ mag_rteparse(char* rtemsg) QString rte_name; if (explorist) { char* ca = rtemsg + n; - is_fatal(*ca++ != ',', MYNAME ": Incorrectly formatted route line '%s'", rtemsg); + if (*ca++ != ',') { + fatal(MYNAME ": Incorrectly formatted route line '%s'", rtemsg); + } char* ce = strchr(ca, ','); - is_fatal(ce == nullptr, MYNAME ": Incorrectly formatted route line '%s'", rtemsg); + if (ce == nullptr) { + fatal(MYNAME ": Incorrectly formatted route line '%s'", rtemsg); + } if (ca == ce) { rte_name = "Route"; diff --git a/mapbar_track.cc b/mapbar_track.cc index be272179c..002c8867c 100644 --- a/mapbar_track.cc +++ b/mapbar_track.cc @@ -116,9 +116,13 @@ mapbar_track_read() int end_flag = gbfgetint32(fin); while (!end_flag) { int length = gbfgetint32(fin); - is_fatal((length < 1) || (length > 1600), MYNAME ": get bad buffer length"); + if ((length < 1) || (length > 1600)) { + fatal(MYNAME ": get bad buffer length"); + } - is_fatal((length % 8 != 0), MYNAME ": bad buffer size"); + if (length % 8 != 0) { + fatal(MYNAME ": bad buffer size"); + } gbfseek(fin, 16, SEEK_CUR); const int amount = length/8; diff --git a/mmo.cc b/mmo.cc index ddf41b046..d58810a00 100644 --- a/mmo.cc +++ b/mmo.cc @@ -826,7 +826,9 @@ mmo_read_object() objid = mmo_object_id++; uint16_t version = gbfgetuint16(fin); - is_fatal(version != mmo_version, MYNAME ": Invalid version identifier!\n"); + if (version != mmo_version) { + fatal(MYNAME ": Invalid version identifier!\n"); + } int len = gbfgetint16(fin); diff --git a/raymarine.cc b/raymarine.cc index aaa1988dd..d99273423 100644 --- a/raymarine.cc +++ b/raymarine.cc @@ -415,8 +415,9 @@ write_route_wpt_cb(const Waypoint* wpt) static void enum_route_hdr_cb(const route_head* rte) { - is_fatal(rte->rte_waypt_ct() > 50, - MYNAME ": Routes with more than 50 points are not supported by Raymarine!"); + if (rte->rte_waypt_ct() > 50) { + fatal(MYNAME ": Routes with more than 50 points are not supported by Raymarine!"); + } } static short_handle diff --git a/subrip.cc b/subrip.cc index 3ced5b26d..6bcb1c7d0 100644 --- a/subrip.cc +++ b/subrip.cc @@ -84,7 +84,9 @@ SubripFormat::subrip_prevwp_pr(const Waypoint* waypointp) switch (*c) { case '%': fmt = *++c; - is_fatal(fmt == '\0', "No character after %% in subrip format"); + if (fmt == '\0') { + fatal("No character after %% in subrip format"); + } switch (fmt) { case 's': @@ -136,7 +138,9 @@ SubripFormat::subrip_prevwp_pr(const Waypoint* waypointp) case '\\': fmt = *++c; - is_fatal(fmt == '\0', "No character after \\ in subrip format"); + if (fmt == '\0') { + fatal("No character after \\ in subrip format"); + } switch (fmt) { case 'n': gbfprintf(fout, "\n"); diff --git a/unicsv.cc b/unicsv.cc index 3faca3f49..96f5a1f7a 100644 --- a/unicsv.cc +++ b/unicsv.cc @@ -300,7 +300,9 @@ UnicsvFormat::unicsv_parse_time(const char* str, int* usec, time_t* date) } } int ct = sscanf(str, "%d%1[.://]%d%1[.://]%d%lf", &hour, sep, &min, sep, &sec, &us); - is_fatal(ct < 5, MYNAME ": Could not parse time string (%s).\n", str); + if (ct < 5) { + fatal(MYNAME ": Could not parse time string (%s).\n", str); + } if (ct == 6) { *usec = lround((us * 1000000)); if (*usec > 999999) { diff --git a/util.cc b/util.cc index fb9921a96..0bae87a0e 100644 --- a/util.cc +++ b/util.cc @@ -533,23 +533,6 @@ printposn(const double c, int is_lat) printf("%f%c ", fabs(c), d); } -void -is_fatal(const int condition, const char* fmt, ...) -{ - va_list args; - char buff[128]; - - if (condition == 0) { - return; - } - - va_start(args, fmt); - vsnprintf(buff, sizeof(buff), fmt, args); - va_end(args); - - fatal("%s\n", buff); -} - /* * Read 4 bytes in big-endian. Return as "int" in native endianness. */ @@ -1136,7 +1119,9 @@ convert_human_date_format(const char* human_datef) okay = 0; } - is_fatal(okay == 0, "Invalid character \"%c\" in date format!", *cin); + if (okay == 0) { + fatal("Invalid character \"%c\" in date format!", *cin); + } } return result; } @@ -1226,7 +1211,9 @@ convert_human_time_format(const char* human_timef) okay = 0; } - is_fatal(okay == 0, "Invalid character \"%c\" in time format!", *cin); + if (okay == 0) { + fatal("Invalid character \"%c\" in time format!", *cin); + } } return result; } diff --git a/vecs.cc b/vecs.cc index b050ef03f..4c5b1485c 100644 --- a/vecs.cc +++ b/vecs.cc @@ -133,8 +133,9 @@ void Vecs::assign_option(const QString& module, arglist_t* arg, const char* val) c = "0"; } else { int test; - is_fatal(1 != sscanf(c, "%d", &test), - "%s: Invalid parameter value %s for option %s", qPrintable(module), val, arg->argstring); + if (1 != sscanf(c, "%d", &test)) { + fatal("%s: Invalid parameter value %s for option %s", qPrintable(module), val, arg->argstring); + } } break; case ARGTYPE_FLOAT: @@ -142,8 +143,9 @@ void Vecs::assign_option(const QString& module, arglist_t* arg, const char* val) c = "0"; } else { double test; - is_fatal(1 != sscanf(c, "%lf", &test), - "%s: Invalid parameter value %s for option %s", qPrintable(module), val, arg->argstring); + if (1 != sscanf(c, "%lf", &test)) { + fatal("%s: Invalid parameter value %s for option %s", qPrintable(module), val, arg->argstring); + } } break; case ARGTYPE_BOOL: diff --git a/xcsv.cc b/xcsv.cc index 20e3ad665..c488de406 100644 --- a/xcsv.cc +++ b/xcsv.cc @@ -1894,7 +1894,9 @@ XcsvFormat::rd_init(const QString& fname) datum_name = "WGS 84"; } xcsv_file->gps_datum_idx = GPS_Lookup_Datum_Index(datum_name); - is_fatal(xcsv_file->gps_datum_idx < 0, MYNAME ": datum \"%s\" is not supported.", qPrintable(datum_name)); + if (xcsv_file->gps_datum_idx < 0) { + fatal(MYNAME ": datum \"%s\" is not supported.", qPrintable(datum_name)); + } assert(gps_datum_wgs84 == GPS_Lookup_Datum_Index("WGS 84")); } @@ -1973,7 +1975,9 @@ XcsvFormat::wr_init(const QString& fname) datum_name = "WGS 84"; } xcsv_file->gps_datum_idx = GPS_Lookup_Datum_Index(datum_name); - is_fatal(xcsv_file->gps_datum_idx < 0, MYNAME ": datum \"%s\" is not supported.", qPrintable(datum_name)); + if (xcsv_file->gps_datum_idx < 0) { + fatal(MYNAME ": datum \"%s\" is not supported.", qPrintable(datum_name)); + } assert(gps_datum_wgs84 == GPS_Lookup_Datum_Index("WGS 84")); } -- 2.30.2